<template>
  <view>
    132132132
  </view>
</template>

<script setup>
import { onMounted } from 'vue';
import { onShow } from '@dcloudio/uni-app';

// 使用正确的语法调用 opendbArticles
const opendbArticles = () => {
  const db = uniCloud.database();
  db.collection("opendb-news-articles").get()
    .then((res) => {
      console.log('home res', res);
    })
    .catch((err) => {
      console.log('home err', err);
    });
};

// 生命周期钩子，确保在组件加载时调用
onMounted(() => {
  opendbArticles();
});

onShow(() => {
  opendbArticles();
});
</script>

<style scoped>
</style>
